package com.ohimy.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 资讯类别封装类
 * 
 * @author Tony Tang
 * @version 1.0
 */
@Entity
@MappedSuperclass
@Table(name = "ohimy_news")
public class News implements Serializable {

	private static final long serialVersionUID = 1L;

	private long id;

	private NewsSort newsSort; // 所属类别

	private String title; // 标题

	private String shortTitle; // 简短标题

	private String from;// 来源

	private String author;// 作者

	private String tag; // Tag标签

	private String content; // 内容

	private Date created; // 发布时间

	private int check; // 审核状态

	private int clicked;// 点击次数

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@ManyToOne(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY, optional = false)
	public NewsSort getNewsSort() {
		return newsSort;
	}

	public void setNewsSort(NewsSort newsSort) {
		this.newsSort = newsSort;
	}

	@Column(name = "_title", length = 64)
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "_shortTitle", length = 32)
	public String getShortTitle() {
		return shortTitle;
	}

	public void setShortTitle(String shortTitle) {
		this.shortTitle = shortTitle;
	}

	@Column(name = "_from", length = 32)
	public String getFrom() {
		return from;
	}

	public void setFrom(String from) {
		this.from = from;
	}

	@Column(name = "_author", length = 16)
	public String getAuthor() {
		return author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	@Column(name = "_tag", length = 32)
	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	@Lob
	@Column(name = "_content")
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "_created", length = 16)
	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	@Column(name = "_check")
	public int getCheck() {
		return check;
	}

	public void setCheck(int check) {
		this.check = check;
	}

	@Column(name = "_clicked")
	public int getClicked() {
		return clicked;
	}

	public void setClicked(int clicked) {
		this.clicked = clicked;
	}

}
